#include<iostream>
#include<vector>
using namespace std;


void swap(int *left, int *right)
    {
    int temp = *left;
    *left = *right;
    *right = temp;
    };


class Solution
{
    // 扔进去AC了他
public:

    int findRepeatNumber(vector<int>& nums)
    {
        int n = nums.size();
        int i =0;
        while(i<n)
        {
           if(nums[i]==i)
           {  i++;
              continue;
           }
           if (nums[nums[i]]==nums[i])
                return nums[i];
           swap(nums[nums[i]],nums[i]);
        }
    return -1;
    }

};


int main() {
    int a[] = {0,1,0};
    int n = sizeof(a)/sizeof(a[0]);
    vector<int> arr(a,a+n);
    int newSize = Solution().findRepeatNumber(arr);
    cout<<newSize<<" ";
    cout<<endl;
    return 0;
}